/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package puzzleevolution;

/**
 *
 * @author vorispe1
 */
public class PuzzlePiece {
    private int id;
    private Pixel[] left;
    private Pixel[] right;
    private Pixel[] up;
    private Pixel[] down;
    private Pixel[][] pieceImage;




    /**
     * Konstruktor
     */
    public PuzzlePiece (){
    }

    /**
     * Konstruktor
     *
     * @param id
     * @param left
     * @param right
     * @param up
     * @param down
     * @param pieceImage
     */
    public PuzzlePiece (int id, Pixel[] left, Pixel[] right, Pixel[] up, Pixel[] down, Pixel[][] pieceImage){
        this.id = id;
        this.left = left;
        this.right = right;
        this.up = up;
        this.down = down;
        this.pieceImage = pieceImage;
    }


    /**
     * Metoda, ktera dilku nastavi hodnoty jeho ctyr hran
     *
     * @param piece1
     */
    public void setFourEdges (Pixel[][] piece1){
        int a = 0;
        int b = 0;
        int c = 0;
        int d = 0;
        Pixel[] levy  = new Pixel[Config.delkaDilku];
        Pixel[] pravy = new Pixel[Config.delkaDilku];
        Pixel[] horni = new Pixel[Config.delkaDilku];
        Pixel[] dolni = new Pixel[Config.delkaDilku];

        //prochazime vsechny pixely dilku
        for(int j = 0; j < Config.delkaDilku;j++){
            for(int i = 0; i < Config.delkaDilku;i++){
                if (i==0)                       { levy[a]  = piece1[i][j]; a++; } //kdyz jsme na pozici prvniho sloupce, pridame hodnotu do pole levy
                if (i==(Config.delkaDilku-1))   { pravy[b] = piece1[i][j]; b++; }
                if (j==0)                       { horni[c] = piece1[i][j]; c++; }
                if (j==(Config.delkaDilku-1))   { dolni[d] = piece1[i][j]; d++; }
            }
        }

        this.setLeft(levy);
        this.setRight(pravy);
        this.setUp(horni);
        this.setDown(dolni);
    }

    /**
     * @return the id
     */
    public int getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * @return the left
     */
    public Pixel[] getLeft() {
        return left;
    }

    /**
     * @param left the left to set
     */
    public void setLeft(Pixel[] left) {
        this.left = left;
    }

    /**
     * @return the right
     */
    public Pixel[] getRight() {
        return right;
    }

    /**
     * @param right the right to set
     */
    public void setRight(Pixel[] right) {
        this.right = right;
    }

    /**
     * @return the up
     */
    public Pixel[] getUp() {
        return up;
    }

    /**
     * @param up the up to set
     */
    public void setUp(Pixel[] up) {
        this.up = up;
    }

    /**
     * @return the down
     */
    public Pixel[] getDown() {
        return down;
    }

    /**
     * @param down the down to set
     */
    public void setDown(Pixel[] down) {
        this.down = down;
    }

    /**
     * @return the pieceImage
     */
    public Pixel[][] getPieceImage() {
        return pieceImage;
    }

    /**
     * @param pieceImage the pieceImage to set
     */
    public void setPieceImage(Pixel[][] pieceImage) {
        this.pieceImage = pieceImage;
    }

}
